#ifndef __WIZ_DATATYPE_BOOLEAN_HPP__SHANHAOBO_19800429__
#define __WIZ_DATATYPE_BOOLEAN_HPP__SHANHAOBO_19800429__

#include "../Base/Type/WizBaseType.hpp"

namespace Wiz
{
    namespace Boolean
    {
        template<class StorageT>
        class Type
        {
            WIZ_DECLARE_CLASS_THIS(Type);
            typedef StorageT    tStorage;
        public:
            Type(){}
            ~Type(){}
            Type(::Wiz::Bool::In b)
            {
                this->m_Value = (b ? this->SCTrue : this->SCFalse);
            }
            Type(tThisIn Other)
            {
                this->m_Value = Other.m_Value;
            }
            Type(const tStorage& InStorage)
            {
                this->m_Value = (InStorage ? this->SCTrue : this->SCFalse);
            }
        public:
            ::Wiz::Bool::Type operator==(::Wiz::Bool::In b) const
            {
                return this->m_Value == (b ? this->SCTrue : this->SCFalse);
            }
            ::Wiz::Bool::Type operator!=(::Wiz::Bool::In b) const
            {
                return !this->operator==(b);
            }

            ::Wiz::Bool::Type operator=(::Wiz::Bool::In b)
            {
                this->m_Value = (b ? this->SCTrue : this->SCFalse);
                return b;
            }
            ::Wiz::Bool::Type operator=(tThisIn Other)
            {
                this->m_Value = Other.m_Value;
                return (this->m_Value == this->SCTrue) ? ::Wiz::Bool::True : ::Wiz::Bool::False;
            }
            ::Wiz::Bool::Type operator=(const tStorage& InStorage)
            {
                this->m_Value = InStorage;
                return (this->m_Value == this->SCTrue) ? ::Wiz::Bool::True : ::Wiz::Bool::False;
            }

            operator ::Wiz::Bool::Type() const
            {
                return (this->m_Value == this->SCTrue) ? ::Wiz::Bool::True : ::Wiz::Bool::False;
            }
        public:
            ::Wiz::Bool::Type IsTrue() const
            {
                return this->operator ::Wiz::Bool::Type();
            }
            ::Wiz::Bool::Type IsFalse() const
            {
                return !this->IsTrue();
            }
        private:
            static const tStorage SCTrue  = 1;
            static const tStorage SCFalse = 0;
            tStorage m_Value;
        };
    } /// end of namespace Boolean

    namespace Boolean8
    {
        WIZ_DECLARE(::Wiz::Boolean::Type<::Wiz::UInt8::Type>);
    } /// end of namespace Boolean8

    namespace Boolean16
    {
        WIZ_DECLARE(::Wiz::Boolean::Type<::Wiz::UInt16::Type>);
    } /// end of namespace Bool16

    namespace Boolean32
    {
        WIZ_DECLARE(::Wiz::Boolean::Type<::Wiz::UInt32::Type>);
    } /// end of namespace Bool32

    namespace Boolean64
    {
        WIZ_DECLARE(::Wiz::Boolean::Type<::Wiz::UInt64::Type>);
    } /// end of namespace Bool64
} /// end of namespace Wiz

#endif /*__WIZ_DATATYPE_BOOLEAN_HPP__SHANHAOBO_19800429__*/
